'''
@Company: TWL
@Author: xue jian
@Email: xuejian@kanzhun.com
@Date: 2020-01-16 18:07:40
'''
import os
import sys
import json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname('__file__'), os.path.pardir)))

import thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hulk_proxy.HulkProxyServ import Client
from scan_data.ttypes import ScanData

__HOST = "172.21.32.54"
__PORT = 10088

try:
    tsocket = TSocket.TSocket(__HOST, __PORT)
    transport = TTransport.TFramedTransport(tsocket)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    client = Client(protocol)

    transport.open()
    tmp_hash = 'wordbag_proxy'
    tmp_map = {'zk_url':'172.21.32.168:2181,172.21.32.136:2181,172.21.32.113:2181,172.21.32.116:2181,172.21.32.196:2181'
    , 'zk_path':'/algorithm_research_center/group6/hulk_proxy/wordbag'}

    client.hmpush(tmp_hash, tmp_map)

    tmp_hash = 'meta_proxy'
    tmp_map = {'zk_url':'172.21.32.168:2181,172.21.32.136:2181,172.21.32.113:2181,172.21.32.116:2181,172.21.32.196:2181'
    , 'zk_path':'/algorithm_research_center/group6/hulk_proxy/meta'}

    client.hmpush(tmp_hash, tmp_map)
    
    tmp_hash = 'index_proxy'
    tmp_map = {'zk_url':'172.21.32.168:2181,172.21.32.136:2181,172.21.32.113:2181,172.21.32.116:2181,172.21.32.196:2181'
    , 'zk_path':'/algorithm_research_center/group6/hulk_proxy/indexservice'}

    client.hmpush(tmp_hash, tmp_map)

    tmp_hash = 'feature_proxy'
    tmp_map = {'zk_url':'172.18.209.78:2181,172.18.192.166:2181,172.18.209.79:2181,172.18.192.179:2181,172.18.209.92:2181,172.18.209.94:2181,172.18.192.184:2181'
    , 'zk_path':'/thrift/rcd/feature_service_push/cn.techwolf.rcd.platform.feature.service/provider'}
    client.hmpush(tmp_hash, tmp_map)


    tmp_hash = 'feature_arc_proxy'
    tmp_map = {'zk_url':'172.18.209.78:2181,172.18.192.166:2181,172.18.209.79:2181,172.18.192.179:2181,172.18.209.92:2181,172.18.209.94:2181,172.18.192.184:2181'
    , 'zk_path':'/thrift/rcd/feature_service_arc/cn.techwolf.rcd.platform.feature.service/provider'}

    client.hmpush(tmp_hash, tmp_map)

    tmp_hash = 'influxdb_proxy'
    tmp_map = {'zk_url':'172.18.39.202:2181,172.18.39.201:2181,172.18.39.204:2181'
    , 'zk_path':'/algorithm_research_center/group6/tcmcp/tcmcp_influxDBServ'}

    client.hmpush(tmp_hash, tmp_map)


    tmp_hash = 'offlinemeta_proxy'
    tmp_map = {'zk_url':'172.21.32.168:2181,172.21.32.136:2181,172.21.32.113:2181,172.21.32.116:2181,172.21.32.196:2181'
    , 'zk_path':'/algorithm_research_center/group6/hulk_proxy/offlinemeta'}
    
    client.hmpush(tmp_hash, tmp_map)


    tmp_hash = 'tcmcp_PSProxy'
    tmp_map = {'zk_url':'172.21.32.168:2181,172.21.32.136:2181,172.21.32.113:2181,172.21.32.116:2181,172.21.32.196:2181'
    , 'zk_path':'/group6_test/gust/ps_moniter/psProxy/'}
    
    client.hmpush(tmp_hash, tmp_map)


    transport.close()
except thrift.TException as ex:
    print(ex.message)